<template>
	<view class="">
		<image src="../../static/images/asd.png" style="width: 100%;height: 375upx;"></image>
		<view class="dm">
			<view @click="roomBtn(item.id,item.roomName)" style="text-align: center;margin-bottom: 30upx;margin-left: 10upx;" v-for="item in dataList">
				<view class="" style="width: 130upx;margin-bottom: 5upx;">
					<image src="../../static/images/yaodian.png" style="width: 60upx;height:60upx;"></image>
				</view>
				<view class="" style="">
					<text>{{item.roomName}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				usersName: '',

				dataList: [],
				dma: [{
					id: '1',
					src: '../../static/dm.png',
					sre: '../../static/sele.png',
					name: '座位1'
				}]
			}
		},
		onLoad() {
			this.initQd()
		},
		methods: {
			initQd() {
				var _this = this
				uni.request({
					url: _this.serverUrl + "renren/readroom/list",
					success(res) {
						_this.dataList = res.data.page.list
					}
				})
			},

			roomBtn(id,name) {
              uni.navigateTo({
              	url:'./zuowei?id='+id+'&name='+name
              })
			},
			//定做位置
			dmBtn(id, name) {
				var usersName = uni.getStorageSync('usersName')
				var usersId = uni.getStorageSync('usersId')
				var _this = this
				uni.request({
					url: _this.serverUrl + 'renren/bookseat/update',
					method: 'POST',
					data: {
						id: id,
						userId: usersId,
						seatState: 1
					},
					success(res) {
						if (res.data.code == 0) {
							uni.showToast({
								icon: 'none',
								title: '预约成功座位:' + name
							})
						}
						if (res.data.code == 500) {
							uni.showToast({
								icon: 'none',
								title: '您已经预约座位:' + res.data.zwId
							})
						}
					}
				})

			},

			msgPer() {
				var a = uni.getStorageSync('usersName')
				this.usersName = a
				if (a == "" || a == null) {
					uni.navigateTo({
						url: '../login/login'
					})
					return false
				}
			}
		}
	}
</script>

<style>
	.dm {
		margin: 40upx 10upx 20upx 30upx;
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-around;
		font-size: 28upx;

	}

	.aa {
		margin-top: 20upx;
		font-weight: bold;
		margin-left: 20upx;
		padding: 20upx;
		font-size: 23upx;
		border-bottom: 1upx solid #CCCCCC;
	}
</style>
